package com.htsk.city.services.admin.controller;

import com.htsk.city.services.admin.annotation.GetLoginUser;
import com.htsk.city.services.admin.params.LoginUser;
import com.htsk.city.services.admin.service.UserService;
import com.htsk.city.services.admin.vo.LoginUserBackVO;
import com.htsk.city.services.core.domain.SysUser;
import com.htsk.city.services.core.entity.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户类业务接口
 */
@RestController
@RequestMapping("user")
public class UserController {
    @Resource
    private UserService userService;

    /**
     * 登录接口
     * @param loginUser 登录用户参数
     * @return 登录信息
     */
    @PostMapping("login")
    public R<LoginUserBackVO> login(@RequestBody LoginUser loginUser){
        return userService.login(loginUser);
    }

    @GetMapping("permission")
    public R<List<String>> permission(@GetLoginUser SysUser sysUser){
        return userService.permissionList(sysUser);
    }
}
